package com.webbei.Backstage.action;

import java.io.IOException;

import org.apache.struts2.ServletActionContext;

import com.webbei.Backstage.service.BackstateSer;

public class NewBrandAction {
		private String brandName;
		private BackstateSer bao;
		public String execute(){
			System.out.println("brandName:"+brandName);
			int i=bao.insertNewBrand(brandName);
			if(i==1){
				try {
					ServletActionContext.getResponse().getWriter().write("success");
					ServletActionContext.getResponse().setContentType("text/html");
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}else{
				try {
					ServletActionContext.getResponse().getWriter().write("fail");
					ServletActionContext.getResponse().setContentType("text/html");
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return null;
		}

		public String getBrandName() {
			return brandName;
		}

		public void setBrandName(String brandName) {
			this.brandName = brandName;
		}

		public BackstateSer getBao() {
			return bao;
		}

		public void setBao(BackstateSer bao) {
			this.bao = bao;
		}
}
